using System;
using System.Collections.Generic;
using System.Data.Linq.Mapping;
using InfoTech.Core.Data.Attributes;
using InfoTech.Core.Data.Dataable;
using InfoTech.Core.Data.Persistence;
using InfoTech.Utilities.Generic;

namespace InfoTech.LanTranh.MucVu.Bussiness
{
	[Serializable]
	[ExtraTable(Name = "GIAODAN_QUANHEGIATOC", Schema="dbo")]
	[Table(Name = "[dbo].[GIAODAN_QUANHEGIATOC]")]
	public partial class GIAODAN_QUANHEGIATOC : ObjPersistence, IDeleteable, IUpdateable, IInsertable, ISelectable, IDeleteablebyId, IUpdateablebyId, ISelectablebyId
	{

		#region Fields

		private System.Guid _magiaodan;

		private System.Guid _magiatoc;

		private QUANHEGIATOC _prt_quanhegiatoc;

		private GIAODAN _prt_giaodan;

		#endregion

		#region Properties

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MAGIAODAN", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MAGIAODAN
		{
			get
			{
				return _magiaodan;
			}
			set
			{
				OnChanged(this, "MAGIAODAN");
				_magiaodan = value;
			}
		}

		[ExtraColumn(DbType = "uniqueidentifier", Length = 0, TypeName = "System.Guid", Type = typeof(System.Guid), CanBeNull = false)]
		[Column(Name = "MAGIATOC", DbType = "uniqueidentifier", IsPrimaryKey = true, CanBeNull = false)]
		public System.Guid MAGIATOC
		{
			get
			{
				return _magiatoc;
			}
			set
			{
				OnChanged(this, "MAGIATOC");
				_magiatoc = value;
			}
		}

		public QUANHEGIATOC PRT_QUANHEGIATOC
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_quanhegiatoc == default(QUANHEGIATOC)))
					InfoTech.Core.Data.Receiver.TypeObject<QUANHEGIATOC>.Select(this, "PRT_QUANHEGIATOC", new[] { new Vector<string, string>("MAGIATOC", "MAQUANHEGIATOC"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_quanhegiatoc;
			}
			set
			{
				_prt_quanhegiatoc = value;
			}
		}

		public GIAODAN PRT_GIAODAN
		{
			get
			{
				if (RefreshType == InfoTech.Core.Data.RefreshType.Allway || (RefreshType == InfoTech.Core.Data.RefreshType.OnlyonNull && _prt_giaodan == default(GIAODAN)))
					InfoTech.Core.Data.Receiver.TypeObject<GIAODAN>.Select(this, "PRT_GIAODAN", new[] { new Vector<string, string>("MAGIAODAN", "MAGIAODAN"), }, InfoTech.Core.Data.RelationType.OnetoOne);
				return _prt_giaodan;
			}
			set
			{
				_prt_giaodan = value;
			}
		}

		#endregion

		#region Reflector

		public System.Type Reflector()
		{
			return typeof(GIAODAN_QUANHEGIATOC);
		}
		public object Current
		{
			get { return this; }
		}

		#endregion

	}
}
